package com.vsen.lpr.controller;

import com.vsen.lpr.common.model.Response;
import com.vsen.lpr.pojo.dto.GetProductListDto;
import com.vsen.lpr.pojo.dto.ShoppingCartDto;
import com.vsen.lpr.pojo.dto.shoppingListDto;
import com.vsen.lpr.pojo.vo.ProductListVo;
import com.vsen.lpr.pojo.vo.ShoppingCartVo;
import com.vsen.lpr.pojo.vo.UserProductVo;
import com.vsen.lpr.service.ProductService;
import com.vsen.lpr.service.ShoppingCardService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;


@Controller
@RequestMapping("/shoppingCart")
@Slf4j
public class ShoppingCartController {


    @Autowired
    private ShoppingCardService shoppingCardService;

    /**
     * 购物车+
     *
     * @return
     */
    @PostMapping("/addShoppingCart")
    @ResponseBody
    Response addShoppingCart(@RequestBody ShoppingCartDto dto) {
        return shoppingCardService.addShoppingCart(dto);
    }

    /**
     * 购物车-
     *
     * @return
     */
    @PostMapping("/reduceShoppingCart")
    @ResponseBody
    Response reduceShoppingCart(@RequestBody ShoppingCartDto dto) {
        return shoppingCardService.reduceShoppingCart(dto);
    }



    /**
     * 购物车列表
     *
     * @return
     */
    @PostMapping("/shoppingCartList")
    @ResponseBody
    Response<ShoppingCartVo> shoppingCartList(@RequestBody shoppingListDto dto) {
        return shoppingCardService.shoppingList(dto);
    }




}
